<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>
    //封装为一个函数 函数参数为传入的字符串
    //返回值为对象结构
    function hanshu(id,page){
        var searchStr="?"+id+"&"+page;
        searchStr=searchStr.slice(1);
        var arr=searchStr.split("&");
        var obj={};
        for(var i=0;i<arr.lengthl;i++){
        var childArr=arr[i].aplit("=");
        console.log(childArr);
        obj[childArr[0]]=childArr[1];
        return obj;
   }
    }
    console.log(hanshu(10,12));
    // var searchStr="?id=10&page=12";
    // console.log(obj);
</script>
</html>